package edt.design.proxy;

import java.lang.reflect.InvocationHandler;

/**
 * 具体业务的动态代理
 * */
public class SubjectDynamicProxy<T> extends DynamicProxy<T> {
	
	public static <T> T newProxyInstance(Subject subject) {
		
		//获得ClassLoader
		
		ClassLoader loader=subject.getClass().getClassLoader();
		
		//获得接口数据
		Class<?>[] classes=subject.getClass().getInterfaces();
		
		
		//获取handler
		InvocationHandler handler=new MyInvocationHandler(subject);
		
		return newProxyInstance(loader, classes, handler);
	}

}
